import android.util.Log
import androidx.compose.foundation.layout.Column
import androidx.compose.material3.Button
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue

@Composable
fun CounterDemo(){
    Log.d("zhongxj","范围1=>运行")
    var counter by remember { mutableStateOf(0) }
    Column {
        Log.d("zhongxj","范围2=>运行")
        Button(onClick = {
            Log.d("zhongxj","onButtonClick:点击按钮")
            counter ++
        }){
            Log.d("zhongxj","范围3=>运行")
            Text(text = "+")
        }

        Text(text = "$counter")
    }
}

